#include <stdio.h>

int main(int argc, char *argv[]) 
{
	
	int b[10] = { 9,8,7,6,5,4,3,2,1,0 };
	
	//冒泡排序
	/*
	for (int i = 0; i < sizeof(b) / sizeof(b[0]) - 1; i++)
		{
			for (int j = 0; j < sizeof(b) / sizeof(b[0]) - 1 - i; j++)
				{
					if (b[j] > b[j + 1])
						{
							int temp = b[j];
							b[j] = b[j + 1];
							b[j + 1] = temp;
						}
				}
		}
		*/
	
	//选择排序
	/*
	int min = 0;
	int minElement = b[0];
	for (int i = 0; i < sizeof(b) / sizeof(b[0]) - 1; i++)
		{
			//找到最小的元素的下标，而不是元素本身
			minElement = b[i];
			for (int j = i; j < sizeof(b) / sizeof(b[0]); j++)
				{
					if (b[j] < minElement)
						{
							minElement = b[j];
							min = j;
						}
				}
			int temp = b[i];
			b[i] = b[min];
			b[min] = temp;
		}
	*/
	
	//插入排序
	/*
	for (int i = 1; i < sizeof(b) / sizeof(b[0]); i++)
		{
			for (int j = i; j > 0; j--)
				{
					if (b[j] < b[j - 1])
						{
							int temp = b[j];
							b[j] = b[j - 1];
							b[j - 1] = temp;
						}
					else
						{
							break;
						}
				}
		}
	*/
	
	
	for (int i = 0; i < sizeof(b) / sizeof(b[0]); i++)
		{
			printf("%d\n", b[i]);
		}
	return 0;
	
	
}